﻿using System;

namespace OpenLS.Spreadsheet.Formats.Biff
{
    internal class MovedContext : IDisposable
    {
        private readonly BiffWriterWorkbookContext _parentContext;
        private readonly long _originalPosition;

        public MovedContext(BiffWriterWorkbookContext parentContext, long originalPosition)
        {
            _parentContext = parentContext;
            _originalPosition = originalPosition;
        }

        public void Dispose()
        {
            _parentContext.Position = _originalPosition;
        }
    }
}